package com.xyw.code.authentication.server.rest;

import lombok.Data;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

/**
 * Created with IntelliJ IDEA.
 * User: xuyiwei
 * Date: 2020/5/27
 * Time: 上午8:52
 * Email: 1328312923@qq.com
 * Description: 重写request  因为网关转发的都是post  这里重写成原始的
 **/
@Data
public class HttpServletRequestAuthWrapper extends HttpServletRequestWrapper {
    //请求的地址  对应request 里面的getServletPath
    private String url;
    //对应这个请求是post合适get
    private String method;
    public HttpServletRequestAuthWrapper(HttpServletRequest request,String url,String method) {
        super(request);
        this.url = url;
        this.method = method;
    }

    @Override
    public String getServletPath() {
        return this.url;
    }

    @Override
    public String getMethod() {
        return this.method;
    }

}
